import request from '@/utils/request'

// 查询角色列表
export function listRole(query) {
  return request({
    url: '/system/role/list',
    method: 'get',
    params: query
  })
}

// 查询角色详细
export function getRole(roleId) {
  return request({
    url: '/system/role/details/' + roleId,
    method: 'get'
  })
}

// 新增角色
export function addRole(data) {
  return request({
    url: '/system/role/save',
    method: 'post',
    data: data
  })
}

// 修改角色
export function updateRole(data) {
  return request({
    url: '/system/role/edit',
    method: 'put',
    data: data
  })
}

// 添加角色权限
export function addAuth(data) {
  return request({
    url: '/system/role/edit/perm',
    method: 'put',
    data: data
  })
}

// 删除角色
export function delRole(roleId) {
  return request({
    url: '/system/role/delete/' + roleId,
    method: 'delete'
  })
}

// 查询表列表
export function listTable(query) {
  return request({
    url: '/system/perms/table/list',
    method: 'get',
    params: query
  })
}

// 查询列列表
export function listColumn(query) {
  return request({
    url: '/system/perms/column/list',
    method: 'get',
    params: query
  })
}

// 修改角色
export function updateColumn(data) {
  return request({
    url: '/system/perms/column/edit',
    method: 'post',
    data: data
  })
}

// 授权用户选择
export function authUserSelectAll(roleId, data) {
  return request({
    url: '/system/role/user/save/' + roleId,
    method: 'post',
    data: data
  })
}

// 取消用户授权角色
export function authUserCancel(roleId, data) {
  return request({
    url: '/system/role/delete/user/role/' + roleId,
    method: 'delete',
    data: data
  })
}